package com.example.fw;

import org.openqa.selenium.By;

public class NavigationHelper extends HelperWithWebDriverBase {
	
	private static String baseUrl;

	public NavigationHelper (ApplicationManager manager) {
		super(manager);
		baseUrl = "http://localhost:8888/addressbookv4.1.4/";
	}
	
	public void goToGroupListPage() {
	if (isElementPresent(By.xpath("//input[@value='New group']"))) {
		return;
	}	
	click(By.linkText("groups"));
	}
	
	void returnToGroupListPage() {
		click(By.linkText("group page"));
	}

	public void openMainPage() {
		openUrl(baseUrl);
	}

	void returnToHomePage() {
		click(By.linkText("home page"));
	}

	void goToHomePage() {
		if (isElementPresent(By.id("maintable"))) {
			return;
		}
		click(By.linkText("home"));
	}
	
}
